<!--  -->
<template>
  <el-button :type="MesStyle.type" @click="open4">{{
    MesStyle.text
  }}</el-button>
</template>

<script lang="ts" setup>
//这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
//例如：import 《组件名称》 from '《组件路径》';
import { ref, defineProps, defineEmits } from "vue";
import { ElMessage, ElMessageBox } from "element-plus";

const props = defineProps({
  MesStyle: {
    type: Object,
    default: {
      type: "",
      text: "默认",
    },
  },
});
const emit = defineEmits(["confirmFn", "cancelFn"]);
const confirmFn = () => {
  ElMessage({
    type: "success",
    message: "确认",
  });
};
const cancelFn = () => {
  ElMessage({
    type: "info",
    message: "取消",
  });
};
const title = ref("是否确认？");
const open4 = () => {
  ElMessageBox.confirm(props.MesStyle, "Warning", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
    .then(() => {
      emit("confirmFn");
      //   ElMessage({
      //     type: "success",
      //     message: "Delete completed",
      //   });
    })
    .catch(() => {
      emit("cancelFn");
      //   ElMessage({
      //     type: "info",
      //     message: "Delete canceled",
      //   });
    });
};
</script>
<style lang="scss" scoped></style>
